;; fac :: int -> int
(define (fac n)
  (define (aux n acc)
    (if (= n 0)
        acc
        (aux (- n 1) (* acc n))))
  (if (< n 0)
      "Error: Negative number"
      (aux n 1)))
        
;; glon :: '(ints) -> int
(define (glon ints)
  (define (aux ints g)
    (case ((null ints) g)
          ((> g (head ints)) (aux (rest ints) g))
          (else (aux (rest ints) (head ints)))))
  (aux (rest ints) (head ints)))
                      
;; fib :: n -> '(fibs)
(define (fib n)
  (define (aux n fibs)
    (case ((= n 2) (reverse fibs))
          ((= n 1) 1)
          (else (aux (- n 1) 
                     (cons (+ (first fibs) (second fibs))
                           fibs)))))
    (if (< n 1)
        "Error: Non-positive number"
        (aux n '(1 1))))
